<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="/res/back/css/base.css" rel="stylesheet" type="text/css" />
<link href="/res/third/bootstrap3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="/res/common/js/jquery.1.9.1.min.js" type="text/javascript"></script>
<script src="/res/third/bootstrap3/jsone/bootstrap.min.js" type="text/javascript"></script>
<script src="/res/third/artDialog/jquery.artDialog.js" type="text/javascript"></script>
<script src="/res/third/validate/jquery.validate.js" type="text/javascript"></script>
<script src="/res/third/layer/layer.js"></script>
<script src="/res/third/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/res/third/easyUI/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/res/third/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
	function sosuo(){
		var lpath =location.pathname;
		//var pageNo = $("#pageNo").val();
		$("#soform").attr("action",lpath+"?pageNo="+1);
		$("#soform").submit();
	}

	/*$(document).ready(function(){
		 $("#startdate").datebox({
		        formatter: function (date) {
		            var y = date.getFullYear();
		            var m = date.getMonth() + 1;
		            var d = date.getDate();
		            return y + '-' + m + '-' + d;
		        }
		    });

		    $("#enddate").datebox({
		        formatter: function (date) {
		            var y = date.getFullYear();
		            var m = date.getMonth() + 1;
		            var d = date.getDate();
		            return y + '-' + m + '-' + d;
		        }
		    })
		 
	});*/
</script>
<style type="text/css">

   .excelbtn{display: inline-block;height: 100%;width: 100px;background-color:#38A4C7;color: #fff;text-align: center;line-height: 35px;cursor: pointer;border-radius:5px;}
	.panel.panel-content{
	overflow-y: scroll;
}
</style>
</head>

<body>
	<div class="panel panel-info panel-content">
	<div class="panel-heading" style="position: relative;">
			<form id="soform" method="post">
				<table>
					<tr>
						<td class="w80" style="padding-top: 5px">
							<label for="companyname" class="center-block">公司名称：</label>
						</td>
						<td class="w150 ">
							<input type="text" class="form-control" name="so_companyName" value="${so_companyName!}" id="so_search" placeholder="公司名称" data-options="">
						</td>
						<td class="w120 ">
							<select class="form-control" name="so_sotime">
							    <option value="" [#if !so_sotime?? || so_sotime=='']selected="selected"[/#if]>全部</option>
								<option value="1" [#if so_sotime?? && so_sotime=='1']selected="selected"[/#if]>签约期内</option>
								<option value="2" [#if so_sotime?? && so_sotime=='2']selected="selected"[/#if]>未开始</option>
								<option value="3" [#if so_sotime?? && so_sotime=='3']selected="selected"[/#if]>已过期</option>
							</select>
						</td>
						<td style="padding-left: 10px">
							<div class="input-group">
								<span class="input-group-btn" style="border: 1px solid #ddd;">
									<button class="btn btn-default" type="button" onclick="sosuo()">搜索</button>
								</span>
							</div>
						</td>
						<td style="padding-left: 10px;font-size: 12px;font-family: inherit;color: inherit;">
							<span class="excelbtn"  onclick="addMember()">添加集采供应商</span>
						</td>
						<td style="padding-left: 10px;font-size: 12px;font-family: inherit;color: inherit;">
							<span class="excelbtn"  onclick="backmoney()">返点收款</span>
						</td>
						<td style="padding-left: 10px;font-size: 12px;font-family: inherit;color: inherit;">
							<span class="excelbtn"  onclick="memberapply()">集采申请</span>
						</td>
					</tr>
				</table>
		</form>
		</div>
		<table class="table table-hover table-bordered table-striped table-condensed">
			<thead>
				<tr>
					<th width="3%">序号</th>
					<th width="20%">供应商名称</th>
					<th width="10%">签约日期</th>
					<th width="10%">结束日期</th>
					<th width="8%">项目成交金额</th>
					<th width="8%">商城成交金额</th>
					<th width="8%">联系人</th>
					<th width="13%">联系电话</th>
					<th width="5%">状态</th>
					<th width="15%">操作</th>
				</tr>
			</thead>
			[#list pagination.list as member]
			<tr>
				<td align="center">${member_index+1!}</td>
				<td align="center">${member.companyName!}</td>
				<td align="center">${(member.signintime?string("yyyy-MM-dd"))!}</td>
				<td align="center">${(member.endtime?string("yyyy-MM-dd"))!}</td>
                <td align="center">
					[#if member.xjPrice??]
                    <a href="javascript:void(0)" onclick="top.addTempTab('/order/order_list.do?ordertype=2&sdate=${(member.signintime?string("yyyy-MM-dd"))!}&edate=${(member.endtime?string("yyyy-MM-dd"))!}&sellerCompanyName=${member.companyName!}')">￥${member.xjPrice?string('0.00')!}</a>
					[#else]
                        ￥0.00
					[/#if]
                </td>
				<td align="center">
				[#if member.shPrice??]
                    <a href="javascript:void(0)" onclick="top.addTempTab('/order/order_list.do?ordertype=1&sdate=${(member.signintime?string("yyyy-MM-dd"))!}&edate=${(member.endtime?string("yyyy-MM-dd"))!}&sellerCompanyName=${member.companyName!}')">￥${member.shPrice?string('0.00')!}</a>
				[#else]
					￥0.00
				[/#if]
				</td>
				<td align="center">${member.contacts!}</td>
				<td align="center">${member.phone!}</td>
				<td align="center">[#if member.state??][#if member.state == 1]正常[#else]暂停[/#if][/#if]</td>
				<td>
				 <button type="button" class="btn btn-info btn-xs delbtn" onclick="backPoint('${member.id!}')">返点策略</button>
				 <button type="button" class="btn btn-success btn-xs delbtn" onclick="showproduct('${member.companyId!}')">商品</button>
				 <button type="button" class="btn btn-primary btn-xs delbtn" onclick="xuyue(${member.id!}, '${(member.signintime?string("yyyy-MM-dd"))!}', '${(member.endtime?string("yyyy-MM-dd"))!}')">续约</button>
				</td>
			</tr>
			[/#list]
		</table>

		<div class="panel-footer">[@fenye p = pagination form = 'infoForm' /]</div>
		 
	</div>
	
	<div id="editoraddView" style="width: 300px; height: 120px; display: none;">
		<form id="editoraddform" method="post" class="form-horizontal" role="form">
            <input type="hidden" name="signintime">
			<input type="hidden" name="id" id="recom_comId">
			<div class="form-group">
				<label class="col-sm-4 control-label">开始时间</label>
				<div class="col-sm-8">
					<input type="text" class="form-control" placeholder="请输入开始时间" id="startdate"  readonly>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-4 control-label">结束时间</label>
				<div class="col-sm-8">
					<input type="text" style="height: 34px;" class="form-control Wdate" placeholder="请输入结束时间" name="endtime" id="enddate" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'startdate\')}'})">
				</div>
			</div>
			<div class="form-group" style="margin-top: 10px; ">
				<div class="col-sm-offset-4">
					<input id="addoreditsub" type="button" onclick="subForm()"  class="btn btn-default" value="提交" />
				</div>
			</div>
		</form>
	</div>
</body>
</html>
<script type="text/javascript">

function memberapply(){
	top.addTempTab("/company/memberapply_list.do");
}

function addMember(){
	//top.addTempTab("/member/member_add.do");
	location.href='/member/member_add.do';
}

function backPoint(mid){
	//alert(mid);
	top.addTab('返点策略', '/member/member_backpoint.do?mid='+mid);
}

function backmoney(){
	top.addTab('返点收款', "/member/cenMemberList.do");
}

function showproduct(companyId) {
	top.addTab("设置集采价", '/product/listProduct.do?state=1&ifPub=1&companyId=' + companyId);
}


var mid;
function xuyue(id, signdate, enddate) {
    $("[name='signintime']").val(signdate);
    //$('#startdate').datebox('setValue', enddate);
    $('#startdate').val(enddate);
	mid=id;
	dialog = art.dialog({
		title : "续约",
		lock : true,
		content : document.getElementById('editoraddView')
	});
}

function subForm(){
	var signintime=$("[name='signintime']").val().trim();
	var _statedate = $('#startdate').val();
	var endtime=$("[name='endtime']").val().trim();
	
	if(signintime=="" || endtime==""){
		alert("续约时间不能为空");
		return false;
	}

	art.dialog.post({
		  
			url : '/member/member_xuyue.do',
			type : 'post',
			dataType : 'json',
			data : {id : mid,signintime:signintime,endtime:endtime},
			beforeSend:function(){
	            art.dialog.tips("处理中...");
	        },
			success : function(data){
				if(data.success){
					alert(data.msg);
					location.reload();
				}else{
					error_msg(data.msg , function(){location.reload();});
				}
			}
	 
	},"数据正在处理中.... ");
}

</script>